<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix='fmt' uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    response.setHeader("X-Frame-Options", "SAMEORIGIN");
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <title>企业基本信息</title>
    <jsp:include page="../../public/public.jsp"/>
<body>

<div style="margin:10px 0 10px 0;"></div>
<div class="easyui-tabs" style="width:1050px;height:650px">
    <div title="企业基本信息" style="padding:10px">
        <form id="addForm" method="post">
            <table id="table-3">
                <tr style="padding-top: 30px">
                    <td style="text-align:right">企业名称：</td>
                    <td>
                        <input type="text" name="name" value="${companyBaseInfo.name}"/>
                        <input type="hidden" id="companyBaseId" name="id" value="${companyBaseInfo.id}"/>
                    </td>

                    <td></td>

                    <td style="text-align:right">营业执照注册号：</td>
                    <td>
                        <input type="text" name="license" value="${companyBaseInfo.license}"/>
                    </td>
                </tr>

                <tr>
                    <td style="text-align:right">注册资金：</td>
                    <td>
                        <input type="text" name="zhuceZijin" value="${companyBaseInfo.zhuceZijin}"/> 万
                    </td>
                    <td></td>
                    <td style="text-align:right">公司电话：</td>
                    <td>
                        <input type="text" name="companyPhone" value="${companyBaseInfo.companyPhone}"/>
                    </td>
                </tr>

                <tr>
                    <td style="text-align:right">企业法人：</td>
                    <td>
                        <input type="text" name="legalPerson" value="${companyBaseInfo.legalPerson}"/>
                    </td>
                    <td></td>
                    <td style="text-align:right">法人手机：</td>
                    <td>
                        <input type="text" name="legalTel" value="${companyBaseInfo.legalTel}"/>
                    </td>
                </tr>


                <tr>
                    <td style="text-align:right">所属地区：</td>
                    <td>
                        <div id="city_1">
                            <select class="prov" name="province"></select>
                            <select class="city" disabled="disabled" name="city"></select>
                            <select class="dist" disabled="disabled" name="area"></select>

                            <input type="hidden" id="province_id" value="${companyBaseInfo.province}"/>
                            <input type="hidden" id="city_id" value="${companyBaseInfo.city}"/>
                            <input type="hidden" id="dist_id" value="${companyBaseInfo.area}"/>
                        </div>
                    </td>
                    <td></td>
                    <td style="text-align:right">公司地址：</td>
                    <td>
                        <input type="text" name="address" value="${companyBaseInfo.address}"/>
                    </td>
                </tr>

                <tr>
                    <td style="text-align:right">联络员姓名：</td>
                    <td>
                        <input type="text" name="contactName" value="${companyBaseInfo.contactName}"/>
                    </td>
                    <td></td>
                    <td style="text-align:right">联络员手机：</td>
                    <td>
                        <input type="text" name="contactTel" value="${companyBaseInfo.contactTel}"/>
                    </td>
                </tr>

                <tr>
                    <td style="text-align:right">总经理：</td>
                    <td>
                        <input type="text" name="manager" value="${companyBaseInfo.manager}"/>
                    </td>
                    <td></td>
                    <td style="text-align:right">总经理联系方式：</td>
                    <td>
                        <input type="text" name="managerTel" value="${companyBaseInfo.managerTel}"/>
                    </td>
                </tr>

                <tr>
                    <td style="text-align:right">单位类型：</td>
                    <td>
                        <select id="companyClassifyId" name="companyClassify" style="width: 223px"
                                value="${companyBaseInfo.companyClassify}">
                            <option value="1"
                                    <c:if test="${'1' eq companyBaseInfo.companyClassify}">selected</c:if> >安防工程单位
                            </option>
                            <option value="2"
                                    <c:if test="${'2' eq companyBaseInfo.companyClassify}">selected</c:if> >安防产品生产单位
                            </option>
                            <option value="3"
                                    <c:if test="${'3' eq companyBaseInfo.companyClassify}">selected</c:if> >销售/代理
                            </option>
                            <option value="4"
                                    <c:if test="${'4' eq companyBaseInfo.companyClassify}">selected</c:if> >其他
                            </option>
                        </select>
                    </td>
                    <td></td>
                </tr>

                <tr>
                    <td style="text-align:right; padding-top: 30px; "><h3>企业员工情况：</h3></td>
                </tr>

                <tr>
                    <td style="text-align:right">博士：</td>
                    <td>
                        <input type="text" name="companyEmployeeStatus.doctorCount"
                               value="${companyBaseInfo.companyEmployeeStatus.doctorCount}"/> 人
                    </td>
                    <td></td>
                    <td style="text-align:right">硕士：</td>
                    <td>
                        <input type="text" name="companyEmployeeStatus.masterCount"
                               value="${companyBaseInfo.companyEmployeeStatus.masterCount}"/> 人
                    </td>
                </tr>

                <tr>
                    <td style="text-align:right">大学本科：</td>
                    <td>
                        <input type="text" name="companyEmployeeStatus.bachelorCount"
                               value="${companyBaseInfo.companyEmployeeStatus.bachelorCount}"/> 人
                    </td>
                    <td></td>
                    <td style="text-align:right">大专：</td>
                    <td>
                        <input type="text" name="companyEmployeeStatus.dazhuanCount"
                               value="${companyBaseInfo.companyEmployeeStatus.dazhuanCount}"/> 人
                    </td>
                </tr>

                <tr>
                    <td style="text-align:right">中专及高中：</td>
                    <td>
                        <input type="text" name="companyEmployeeStatus.zhongzhuanCount"
                               value="${companyBaseInfo.companyEmployeeStatus.zhongzhuanCount}"/> 人
                    </td>

                </tr>

                <tr>
                    <td style="text-align:right;padding-top: 30px; "><h3>技术人员情况：</h3></td>
                </tr>

                <tr>
                    <td style="text-align:right">助工：</td>
                    <td>
                        <input type="text" name="companyEmployeeStatus.zhugongCount"
                               value="${companyBaseInfo.companyEmployeeStatus.zhugongCount}"/> 人
                    </td>
                    <td></td>
                    <td style="text-align:right">工程师：</td>
                    <td>
                        <input type="text" name="companyEmployeeStatus.gongchengshiCount"
                               value="${companyBaseInfo.companyEmployeeStatus.gongchengshiCount}"/> 人
                    </td>
                </tr>

                <tr>
                    <td style="text-align:right">高工：</td>
                    <td>
                        <input type="text" name="companyEmployeeStatus.gaogongCount"
                               value="${companyBaseInfo.companyEmployeeStatus.gaogongCount}"/> 人
                    </td>

                </tr>


                <tr>
                    <td style="text-align:right;padding-top: 30px;"><h3>企业实力：</h3></td>
                </tr>

                <tr>
                    <td style="text-align:right">发明创造：</td>
                    <td>
                        <input type="text" name="companyEmployeeStatus.famingCount"
                               value="${companyBaseInfo.companyEmployeeStatus.famingCount}"/> 项
                    </td>
                    <td></td>
                    <td style="text-align:right">著作权：</td>
                    <td>
                        <input type="text" name="companyEmployeeStatus.zhuzuoquanCount"
                               value="${companyBaseInfo.companyEmployeeStatus.zhuzuoquanCount}"/> 项
                    </td>
                </tr>

                <tr>
                    <td style="text-align:right">经营范围：</td>
                    <td colspan="4">
                        <textarea cols="100" rows="6"
                                  name="companyEmployeeStatus.jingyingFanwei">${companyBaseInfo.companyEmployeeStatus.jingyingFanwei}</textarea>
                    </td>
                </tr>

                <tr>
                    <td style="text-align:right">单位简介：</td>
                    <td colspan="4">
                        <textarea cols="100" rows="6"
                                  name="companyEmployeeStatus.companyJieshao">${companyBaseInfo.companyEmployeeStatus.companyJieshao}</textarea>
                    </td>
                </tr>

            </table>
        </form>
        <input type="button" value="提交信息" onclick="add();"
               style="margin-left: 350px; margin-top: 30px; margin-bottom: 20px"/>
    </div>
    <div title="资信等级信息" style="padding:10px">
        <form id="addForm_zizhi" method="post">
            <table id="table-4">
                <tr style="padding-top: 30px">
                    <%-- <td style="text-align:right">协会职务：</td>
                     <td>
                         <select name="xiehuiZhiwu" style="width: 223px" value="${companyBaseInfo.companyLevelInfo.xiehuiZhiwu}">
                             <option value="0" <c:if test="${'0' eq companyBaseInfo.companyLevelInfo.xiehuiZhiwu}">selected</c:if> >无</option>
                             <option value="1" <c:if test="${'1' eq companyBaseInfo.companyLevelInfo.xiehuiZhiwu}">selected</c:if> >会长</option>
                             <option value="2" <c:if test="${'2' eq companyBaseInfo.companyLevelInfo.xiehuiZhiwu}">selected</c:if> >副会长</option>
                             <option value="3" <c:if test="${'3' eq companyBaseInfo.companyLevelInfo.xiehuiZhiwu}">selected</c:if> >秘书长</option>
                         </select>
                         <input type="hidden" id="companyLevelInfoId" name="id" value="${companyBaseInfo.companyLevelInfo.id}"/>
                         <input type="hidden" id="companyLevelInfoId" name="id" value="${companyBaseInfo.companyLevelInfo.id}"/>
                         <input type="hidden" id="companyId" name="companyId" value="${companyBaseInfo.companyLevelInfo.companyId}"/>
                     </td>

                     <td></td>

                     <td style="text-align:right">获证时间：</td>
                     <td>
                         <input class="easyui-datetimebox" name="huozhengTime"
                                data-options="required:true" value="${companyBaseInfo.companyLevelInfo.huozhengTime}" style="width:223px">
                     </td>
                 </tr>

                 <tr>
                     <td style="text-align:right">资信等级：</td>
                     <td>
                         <select id="zixinDengji" name="zixinDengji" style="width: 223px" value="${companyBaseInfo.companyLevelInfo.zixinDengji}">
                             <option value="0" <c:if test="${'0' eq companyBaseInfo.companyLevelInfo.zixinDengji}">selected</c:if> ></option>
                             <option value="1" <c:if test="${'1' eq companyBaseInfo.companyLevelInfo.zixinDengji}">selected</c:if> >一级</option>
                             <option value="2" <c:if test="${'2' eq companyBaseInfo.companyLevelInfo.zixinDengji}">selected</c:if> >二级</option>
                             <option value="3" <c:if test="${'3' eq companyBaseInfo.companyLevelInfo.zixinDengji}">selected</c:if> >三级</option>
                         </select>

                     </td>
                     <td></td>
                     <td style="text-align:right">资信等级证书编号：</td>
                     <td>
                         <input type="text" name="zixinDengjiNo" value="${certificatoryCompList.[0].certificateNum}"/>
                     </td>--%>


                    <c:forEach items="${certificatoryCompList}" var="certificatoryComp" varStatus="vs">
                <tr>

                    <td>
                        <s:property value="#vs.index+1"/>
                    </td>
                <td style="text-align:right">证书类型：</td>
                    <td align="center">${certificatoryComp.certificateType}</td>
                <td style="text-align:right">资信等级：</td>
                    <td align="center">${certificatoryComp.certificateLevel}</td>
                <td style="text-align:right">证书编号：</td>
                    <td align="center">${certificatoryComp.certificateNum}</td>
                <td style="text-align:right">有效时间：</td>
                    <td align="center">${certificatoryComp.certificateValidityStr}</td>
                </tr>

                </c:forEach>
                </tr>


            </table>
            <%--<input type="button" value="提交信息" onclick="add_zizhi();" style="margin-left: 350px; margin-top: 30px; margin-bottom: 20px"/>--%>
        </form>
    </div>
    <div title="修改密码" style="padding:10px">
        This is the help content.
    </div>
</div>

<script>

    $(function () {

        $("#city_1").citySelect({prov: "浙江", city: "杭州", dist: "西湖区"}); // 初始化

        // 如果数据库有值，那么需要定位到已保存的值
        if ($("#province_id").val() != "") {
            $("#city_1").citySelect({
                prov: $("#province_id").val(),
                city: $("#city_id").val(),
                dist: $("#dist_id").val()
            });
        }

    });


    /* 点击 保存时触发 */
    function add() {
        $.ajax({
            url: '<%=basePath %>companyBase/insertBaseInfo',
            type: 'post',
            data: $("#addForm").serialize(),
            dataType: 'json',
            error: function () {
                $.messager.alert("友情提示", "系统异常,请稍后尝试", "error");
            },
            success: function (data) {
                var row = data.row;
                var msg = data.msg;
                var companyBaseId = data.companyBaseId;
                $("#companyBaseId").val(companyBaseId);
                $("#companyId").val(companyBaseId);
                $.messager.alert("友情提示", msg, "info");

            }
        });
    }


    /* 点击 保存时触发 */
    function add_zizhi() {
        $.ajax({
            url: '<%=basePath %>companyBase/insertLevelInfo',
            type: 'post',
            data: $("#addForm_zizhi").serialize(),
            dataType: 'json',
            error: function () {
                $.messager.alert("友情提示", "系统异常,请稍后尝试", "error");
            },
            success: function (data) {
                var row = data.row;
                var msg = data.msg;
                var companyLevelInfoId = data.companyLevelInfoId;
                $("#companyLevelInfoId").val(companyLevelInfoId);
                $.messager.alert("友情提示", msg, "info");

            }
        });
    }

</script>
</body>
</html>


<style>
    /* Border styles */
    #table-3 thead, #table-3 tr {
        border-top-width: 1px;
        border-top-style: solid;
        border-top-color: rgb(235, 242, 224);
    }

    /* Padding and font style */
    #table-3 td, #table-3 th {
        width: 250px;
        padding: 5px 10px;
        font-size: 12px;
        font-family: Verdana;
    }

    #table-3 td input {
        width: 220px;
    }

    /* Border styles */
    #table-4 thead, #table-4 tr {
        border-top-width: 1px;
        border-top-style: solid;
        border-top-color: rgb(235, 242, 224);
    }

    /* Padding and font style */
    #table-4 td, #table-4 th {
        width: 250px;
        padding: 5px 10px;
        font-size: 12px;
        font-family: Verdana;
    }

    #table-4 td input {
        width: 220px;
    }
</style>